import Cookie from 'js-cookie'

export default {
  namespaced: true,
  state: {
    token: Cookie.get('token') || ''
  },
  mutations: {
    SAVE_TOKEN(state, str) {
      if (str && typeof str === 'string') {
        state.token = str
        Cookie.set('token', str)
      }
    }
  },
  actions: {}
}
